package com.vf.admin.miaodong.service.impl;

import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.dao.AfterOrderDao;
import com.vf.admin.miaodong.dao.AfterVipOrderDao;
import com.vf.admin.miaodong.entity.AppMingxiChongzhi;
import com.vf.admin.miaodong.entity.VipOrder;
import com.vf.admin.miaodong.service.AfterVipOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>Title : </p>
 * <p>Description : </p>
 * <p>DevelopTools : IDEA</p>
 * <p>DevelopSystem : Windows11</p>
 *
 * @Author : zxw
 * @Date 2023/8/9 21:05
 */
@Service
public class AfterVipOrderServiceImpl implements AfterVipOrderService {


    @Autowired
    private AfterVipOrderDao afterVipOrderDao;

    @Override
    public List<VipOrder> findList(Map<String, Object> map, SplitPageBean bean) {

        return afterVipOrderDao.findList(map,bean);
    }

    @Override
    public Double total(Map<String, Object> params) {

        BigDecimal b = BigDecimal.ZERO;
        List<VipOrder> total = afterVipOrderDao.total(params);
        for (VipOrder e : total) {
            if (e.getPrice().compareTo(BigDecimal.ZERO) != 0) {
//                BigDecimal divide = e.getMoney().divide(new BigDecimal("100"));
                b = b.add(e.getPrice());
            }
        }
        return b.doubleValue();
    }

    @Override
    public List<VipOrder> list(Map<String, Object> params) {
        return afterVipOrderDao.list(params);
    }

    @Override
    public Double todayMengPiao(Map<String, Object> params) {
        BigDecimal b = BigDecimal.ZERO;
        List<VipOrder> total = afterVipOrderDao.todayMengPiao(params);
        for (VipOrder e : total) {
            if (e.getPrice().compareTo(BigDecimal.ZERO) != 0) {
//                BigDecimal divide = e.getMoney().divide(new BigDecimal("100"));
                b = b.add(e.getPrice());
            }
        }
        return b.doubleValue();
    }

    @Override
    public List<VipOrder> getVipOrderTicketV2(Map<String, Object> params) {
        return afterVipOrderDao.getVipOrderTicketV2(params);
    }

    @Override
    public List<VipOrder> getVipOrderV2(Map<String, Object> params) {
        return afterVipOrderDao.getVipOrderV2(params);
    }
}
